<template>
  <view class="good-list">
    <uni-list>
      <uni-list-item v-for="(item, index) in list" :key="index" style="align-items: center">
        <template slot="body">
          <view class="u-cell-group" @click="navigateTo(item)">
            <view class="title">{{$t('用印人')}}：{{ item.userName }}</view>
            <view>{{$t('申请单名称')}}：{{ item.contractTitle }}</view>
            <view>{{$t('电子印章名')}}：{{ item.sealName }}</view>
            <view>{{$t('使用方式')}}：{{ item.authorize && item.authorize.remark }}</view>
            <view>{{$t('使用次数')}}：{{ item.signTotal }}</view>
            <view>{{$t('用印日期')}}：{{ item.createDate }}</view>
          </view>
        </template>
        <template slot="footer">
          <view class="footer">
            <u-tag style="width: 100rpx" :text="$t('查看')" @click="seeFn(item)" />
          </view>
        </template>
      </uni-list-item>
    </uni-list>
  </view>
</template>

<script>
import { mapGetters, mapMutations } from 'vuex'

export default {
  computed: {
    ...mapGetters(['userInfo', 'api'])
  },
  props: {
    list: {
      type: [Array],
      default() {
        return []
      }
    }
  },
  data() {
    return {}
  },
  mounted() {
  },
  methods: {
    seeFn(row) {
      uni.navigateTo({
        url: '../../electronicSeal/pdfPreview/pdfPreview',
        events: {
          confirm(data) {
            //console.log(data);
          }
        },
        success(res) {
          res.eventChannel.emit('pagePramas', {
            sealInfoId: row.sealInfoId,
            sealId: row.sealId,
            type: '盖章记录'
          })
        }
      })
    },
    navigateTo(item) {
      if (item.title === '设备拆卸') {
        uni.navigateTo({
          url: '../dismounting/dismounting?id=' + item.id
        })
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.good-list {
  background-color: #fff;
  width: 100%;

  .u-cell-group {
    font-size: 28rpx;
    color: #888;
    line-height: 48rpx;
    box-sizing: border-box;
    width: 100%;
    display: flex;
    flex-direction: column;

    .title {
      font-weight: bold;
      color: #000;
    }

    .error-item {
      color: red;
    }
  }

  .slot-content {
    padding: 20rpx 30rpx;
  }

  .footer {
    margin: auto;
  }
}
</style>
